<?php

namespace app\index\controller\ad;

use app\index\service\AdConsultingInfoService;
use ShidianUtil\Thinkphp\Response\ApiResponse;
use ShidianUtil\Utils\CheckUtil;
use think\Request;

/**
 * 未付费H5
 * Class ConsultingInfo
 * @package app\index\controller\ad
 */
class ConsultingInfo
{

    private AdConsultingInfoService $adConsultingInfoService;
    private Request $request;

    public function __construct(Request $request, AdConsultingInfoService $adConsultingInfoService)
    {

        $this->request = $request;
        $this->adConsultingInfoService = $adConsultingInfoService;
    }

    /**
     * 人数
     * @return ApiResponse
     */
    public function read(): ApiResponse
    {
        $id = $this->request->param('id');

        if (!CheckUtil::isId($id)) {
            return ApiResponse::fail('缺少id参数');
        }

        return ApiResponse::success($this->adConsultingInfoService->read($id));
    }

}
